package com.laboratory.service.impl;

import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.laboratory.listener.LabSubListener;
import com.laboratory.mapper.LabSubMapper;
import com.laboratory.model.dto.labSub.LabSubQueryDTO;
import com.laboratory.model.entity.LabSub;
import com.laboratory.model.vo.labSub.LabSubEeVo;
import com.laboratory.model.vo.labSub.LabSubVo;
import com.laboratory.service.LabSubService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 */
@Service
public class LabSubServiceImpl extends ServiceImpl<LabSubMapper, LabSub>
    implements LabSubService {

    @Override
    public List<LabSubVo> getAll(Integer pIndex, Integer pSize, LabSubQueryDTO labSubQueryDTO) {
        // 开启分页
        PageHelper.startPage(pIndex, pSize);

        return baseMapper.getAll(labSubQueryDTO);
    }

    @Override
    public void importLab() {
        EasyExcel.write("D:\\实验室信息.xlsx", LabSubEeVo.class).sheet("实验室").doWrite(baseMapper.getExportDate());
    }

    @Override
    public void joinLab() {
        EasyExcel.read("D:\\实验室信息.xlsx", LabSubEeVo.class,new LabSubListener(baseMapper))
                .sheet("实验室")
                .doRead();
    }

}




